<%@page import="java.text.SimpleDateFormat"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!doctype html>
<html>
<head>
<title>统计分析2</title>
<base href="<%=basePath%>" />
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="renderer" content="webkit|ie-stand|ie-comp">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="apple-touch-icon-precomposed" href="i/app-icon72x72@2x.png">
<meta name="apple-mobile-web-app-title" content="" />
<link rel="stylesheet" href="layui/css/layui.css">
<style type="text/css">

</style>
</head>
<%
	String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
%>
<body data-type="generalComponents">
	<table class="layui-table" id="Gold" lay-filter="Gold">
        <caption style="color:#d71345">金币</caption>
    </table>
    <%-- <br>
    <table class="layui-table" id="recoveryGold" lay-filter="recoveryGold">
        <caption style="color:#d71345">回收金币</caption>
    </table>
    <br>
    <table class="layui-table" id="Greb" lay-filter="Greb">
        <caption style="color:#d71345">全服平台总收益</caption>
    </table> 
    <br>
    <table class="layui-table" id="sendGold" lay-filter="sendGold">
        <caption style="color:#d71345">发放金币金币</caption>
    </table>  --%>
    <br>
    <table class="layui-table" id="Diamonds" lay-filter="Diamonds">
        <caption style="color:#d71345">钻石</caption>
    </table>
    <br>
    <table class="layui-table" id="Warhead" lay-filter="Warhead">
        <caption style="color:#d71345">弹头</caption>
    </table>
    <br>
    <table class="layui-table" id="Prop" lay-filter="Prop">
        <caption style="color:#d71345">道具</caption>
    </table>
    <br>
    <table class="layui-table" id="MaterialScience" lay-filter="MaterialScience">
        <caption style="color:#d71345">材料</caption>
    </table>
    <br>
    
	<script src="js/jquery.min.js"></script>
	<script src="layui/layui.js"></script>
	<script src="js/personal/formsubmit.js"></script>
	
	<script id="AllWaterLinePull" type="text/html">
	    {{# d.AllWaterLinePull = d.ThreeFishingWaterLinePull 
                                   + d.LbjWaterLinePull 
                                   + d.ShzWaterLinePull
                                   + d.HBWaterLinePull 
                                   + d.DdsWaterLinePull
                                   + d.LhdWaterLinePull}}
           <span>{{d.AllWaterLinePull}}</span>
        {{# }}
	</script>
	
	<script id="AllFeeGrab" type="text/html">
	    {{# d.AllFeeGrab = d.ThreeFishingFeeGrab 
                                   + d.LbjFeeGrab 
                                   + d.ShzFeeGrab
                                   + d.HBFeeGrab 
                                   + d.DdsFeeGrab
                                   + d.LhdFeeGrab}}
           <span>{{d.AllFeeGrab}}</span>
        {{# }}
	</script>
	
	<script id="AllWaterLinePush" type="text/html">
	    {{# d.AllWaterLinePush = d.ThreeFishingWaterLinePush
                                   + d.LbjWaterLinePush
                                   + d.ShzWaterLinePush
                                   + d.HBWaterLinePush
                                   + d.DdsWaterLinePush
                                   + d.LhdWaterLinePush}}
           <span>{{d.AllWaterLinePush}}</span>
        {{# }}
	</script>
	
	<script id="GainByRecharge" type="text/html">
	    {{# d.GainByRecharge = d.TotalGain
                                   - d.resource_log_reason_fishing_gain_boom
                                   - d.resource_log_reason_fishing_gain_bonus_wheel
                                   }}
           <span>{{d.GainByRecharge}}</span>
        {{# }}
	</script>
	
	<script>
          layui.use(['layer','table','form'],function(){
        	  var layer = layui.layer,
        	      table = layui.table,
        	      form = layui.form;
        	  
        	var data;
        	var data2;
        	var limit = 50;
          	$(document).ready(function(){
          		$.ajax({
          			type:"POST",
          			url:'Essential/list',
          			async:false,
          			success:function(resp){
          				data=JSON.parse(resp);
          			}
          		}).done(function(){
          			$.ajax({
          				type:"POST",
              			url:'stat/loadStat',
              			async:false,
              			success:function(resp){
              				data2=JSON.parse(resp);
              				for(var i = 0;i < data2.data.length;i++){
              					if(data2.data[i].resource_log_reason_fishing_gain_boom ===undefined){
               						var obj = {resource_log_reason_fishing_gain_boom:0};
               						data2.data[i]['resource_log_reason_fishing_gain_boom'] = obj['resource_log_reason_fishing_gain_boom'];
               					}
              					if(data2.data[i].resource_log_reason_fishing_gain_bonus_wheel ===undefined){
               						var obj = {resource_log_reason_fishing_gain_bonus_wheel:0};
               						data2.data[i]['resource_log_reason_fishing_gain_bonus_wheel'] = obj['resource_log_reason_fishing_gain_bonus_wheel'];
               					}
              				}
              			}
          			})
          		});
          	});
        	  
        	  table.render({
        		  elem:'#Gold',
        		  method : 'post',
        		  totalRow:true,
        		  cellMinWidth : 80, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
        		  id:'AllTable1',
        		  cols:[[
        			  {field : 'AllCurrencyStock',title : '全服金币存量'}, 
        			  {field : 'CurrencyStock',title : '大厅金币存量'},
        			  {field : 'BankCurrencyStock',title : '金库金币存量'},
        			  {field : 'GoldGainByRecharge',title : '充值获得总金币'},
        			  {field : 'GoldFalseGainByRecharge',title : '非充值获得总金币'},
        			  {field : 'GoldTotalCost',title : '全服金币总消耗'}
        			  ]],
        			  limit: limit,
          			data:data
        	  });
        	  
        	  table.render({
        		  elem:'#recoveryGold',
        		  method : 'post',
        		  totalRow:true,
        		  cellMinWidth : 80, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
        		  id:'AllTable2',
        		  cols:[[
        			  {field : 'Name',title : '名称',hide:true},
        			  {field : 'AllWaterLinePull',title : '全服总抽水额度',templet:'#AllWaterLinePull'}, 
        			  {field : 'ThreeFishingWaterLinePull',title : '捕鱼3D抽水额度'}, 
        			  {field : 'LbjWaterLinePull',title : '拉霸机抽水额度'}, 
        			  {field : 'ShzWaterLinePull',title : '水浒传抽水总额度'},
        			  {field : 'HBWaterLinePull',title : '抢红包抽水总额度'},
        			  {field : 'DdsWaterLinePull',title : '打地鼠抽水总额度'},
        			  {field : 'LhdWaterLinePull',title : '龙虎斗抽水总额度'},
        			  {field : 'resource_log_reason_cost_vip_lottery',title : '大厅轮盘回收'}
        			  ]],
        			  limit: limit,
        			  done:function(res, curr, count){
           				for(var i = 0;i < res.data.length;i++){
           					if(res.data[i].Name != '金币'){
           						$("[lay-id='AllTable2'] tbody tr[data-index=" + i + "]").hide();
           					}
           				}
            		  },
          			data:data2.data
        	  });
        	  
        	  table.render({
        		  elem:'#Greb',
        		  method : 'post',
        		  totalRow:true,
        		  cellMinWidth : 80, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
        		  id:'AllTable3',
        		  cols:[[
        			  {field : 'Name',title : '名称',hide:true},
        			  {field : 'AllFeeGrab',title : '全服平台总收益',color:'red',templet:'#AllFeeGrab'}, 
        			  {field : 'ThreeFishingFeeGrab',title : '捕鱼3D平台收益'}, 
        			  {field : 'LbjFeeGrab',title : '拉霸机平台收益'}, 
        			  {field : 'ShzFeeGrab',title : '水浒传平台收益'},
        			  {field : 'HBFeeGrab',title : '抢红包平台收益'},
        			  {field : 'DdsFeeGrab',title : '打地鼠平台收益'},
        			  {field : 'LhdFeeGrab',title : '龙虎斗平台收益'}
        			  ]],
        			  limit: limit,
        			  done:function(res, curr, count){
             				for(var i = 0;i < res.data.length;i++){
             					if(res.data[i].Name != '金币'){
             						$("[lay-id='AllTable3'] tbody tr[data-index=" + i + "]").hide();
             					}
             				}
              		  },
          			data:data2.data
        	  });
        	  
        	  table.render({
        		  elem:'#sendGold',
        		  method : 'post',
        		  totalRow:true,
        		  cellMinWidth : 80, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
        		  id:'AllTable4',
        		  cols:[[
        			  {field : 'AllWaterLinePush',title : '全服总放水',templet:'#AllWaterLinePush'}, 
        			  {field : 'ThreeFishingWaterLinePush',title : '捕鱼3D放水'}, 
        			  {field : 'LbjWaterLinePush',title : '拉霸机放水'}, 
        			  {field : 'ShzWaterLinePush',title : '水浒传放水'},
        			  {field : 'HBWaterLinePush',title : '抢红包放水'},
        			  {field : 'DdsWaterLinePush',title : '打地鼠放水'},
        			  {field : 'LhdWaterLinePush',title : '龙虎斗放水'},
        			  {field : 'resource_log_reason_gain_shop_recharge',title : '充值获得总金币'}, 
        			  {field : 'resource_log_reason_gain_mail',title : '客服邮件发送'}, 
        			  {field : 'resource_log_reason_gain_vip_lottery',title : '轮盘发放金币'}, 
        			  {field : 'resource_log_reason_gain_cdkey_code',title : '兑换码发放金币'},
        			  {field : 'resource_log_reason_gain_welfare_pig_broken',title : '金猪发放金币'}, 
        			  {field : 'resource_log_reason_gain_first_package',title : '起航礼包发放金币'}, 
        			  {field : 'resource_log_reason_fishing_gain_bonus_wheel',title : '奖金鱼抽奖发放金币'}, 
        			  {field : 'resource_log_reason_fishing_gain_boss_kill',title : '世界BOSS固定奖励发放金币'}
        			  ]],
        			  limit: limit,
        			  done:function(res, curr, count){
           				for(var i = 0;i < res.data.length;i++){
           					if(res.data[i].Name != '金币'){
           						$("[lay-id='AllTable4'] tbody tr[data-index=" + i + "]").hide();
           					}
           				}
            		  },
          			data:data2.data
        	  });
        	  
        	  table.render({
        		  elem:'#Diamonds',
        		  method : 'post',
        		  totalRow:true,
        		  cellMinWidth : 80, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
        		  id:'AllTable5',
        		  cols:[[
        			  {field : 'Name',title : '名称',hide:true}, 
        			  {field : 'DiamondCurrentCount',title : '全服钻石存量',color:'red'}, 
        			  {field : 'DiamondTotalGain',title : '全服钻石总获得'}, 
        			  {field : 'DiamondGainByRecharge',title : '充值获得总钻石'}, 
        			  {field : 'DiamondFalseGainByRecharge',title : '非充值获得总钻石'},
        			  {field : 'DiamondTotalCost',title : '钻石总消耗'}
        			  ]],
        			  limit: limit,
          			data:data
        	  });
        	  
        	  table.render({
        		  elem:'#Warhead',
        		  method : 'post',
        		  totalRow:true,
        		  cellMinWidth : 80, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
        		  id:'AllTable6',
        		  cols:[[
        			  {field : 'Name',title : '名称'},
        			  {field : 'CurrentStock',title : '弹头存量',color:'red'}, 
        			  {field : 'TotalGain',title : '弹头总获得'}, 
        			  {field : 'resource_log_reason_fishing_gain_boom',title : '捕鱼掉落弹头'}, 
        			  {field : 'resource_log_reason_fishing_gain_bonus_wheel',title : '奖金抽奖掉落弹头'},
        			  {field : 'GainByRecharge',title : '其他玩法获得弹头',templet:'#GainByRecharge'},
        			  {field : 'TotalCost',title : '弹头消耗个数'}
        			  ]],
        			  limit: limit,
        			  done:function(res, curr, count){
           				for(var i = 0;i < res.data.length;i++){
           					if(res.data[i].Name != '青铜弹头' && res.data[i].Name != '白银弹头' && res.data[i].Name != '黄金弹头' && res.data[i].Name != '紫金弹头'){
           						$("[lay-id='AllTable6'] tbody tr[data-index=" + i + "]").hide();
           					}
           				}
            		  },
          			data:data2.data
        	  });
        	  
        	  table.render({
        		  elem:'#Prop',
        		  method : 'post',
        		  totalRow:true,
        		  cellMinWidth : 80, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
        		  id:'AllTable7',
        		  cols:[[
        			  {field : 'Name',title : '名称'},
        			  {field : 'CurrentStock',title : '道具存量',color:'red'}, 
        			  {field : 'TotalGain',title : '总获得'}, 
        			  {field : 'resource_log_reason_fishing_gain_boom',title : '捕鱼3D掉落'}, 
        			  {field : 'daojupingtaiGain',title : '平台内获得'},
        			  {field : 'resource_log_reason_cost_item_use',title : '道具消耗量'}
        			  ]],
        			  limit: limit,
        			  done:function(res, curr, count){
             				for(var i = 0;i < res.data.length;i++){
             					if(res.data[i].Name != '锁定' && res.data[i].Name != '冰冻' && res.data[i].Name != '召唤' && res.data[i].Name != '狂暴卡' && res.data[i].Name != '分身卡'){
             						$("[lay-id='AllTable7'] tbody tr[data-index=" + i + "]").hide();
             					}
             				}
              		  },
          			data:data2.data
        	  });
        	  
        	  table.render({
        		  elem:'#MaterialScience',
        		  method : 'post',
        		  totalRow:true,
        		  cellMinWidth : 80, //全局定义常规单元格的最小宽度，layui 2.2.1 新增
        		  id:'AllTable8',
        		  cols:[[
        			  {field : 'Name',title : '名称'},
        			  {field : 'CurrentStock',title : '材料存量'}, 
        			  {field : 'resource_log_reason_fishing_gain_boom',title : '捕鱼掉落'},
        			  {field : 'TotalGain',title : '材料总获得'}, 
        			  {field : 'TotalCost',title : '材料总消耗'}
        			  ]],
        			  limit: limit,
        			  done:function(res, curr, count){
           				for(var i = 0;i < res.data.length;i++){
           					if(res.data[i].Name != '防水木料' && res.data[i].Name != '精炼矿石' && res.data[i].Name != '海妖外壳' && res.data[i].Name != '潮汐精粹' && res.data[i].Name != '深海魔晶' && res.data[i].Name != '倍击道具'){
           						$("[lay-id='AllTable8'] tbody tr[data-index=" + i + "]").hide();
           					}
           				}
            		  },
          			data:data2.data
        	  });
        	  
        	  setInterval(function(){
        		  $.ajax({
            			type:"POST",
            			url:'Essential/list',
            			async:false,
            			success:function(resp){
            				data=JSON.parse(resp);
            				setTimeout(function(){
              					table.reload('AllTable1', {data:data});
              				},1000);
            				
            			}
            		}).done(function(){
            			$.ajax({
            				type:"POST",
                			url:'stat/loadStat',
                			async:false,
                			success:function(resp){
                				data2=JSON.parse(resp);
                				setTimeout(function(){
                  	              	table.reload('AllTable2', {data:data2.data});
                  	              	table.reload('AllTable3', {data:data2.data});
                  	              	table.reload('AllTable4', {data:data2.data});
                  	              	table.reload('AllTable5', {data:data2.data});
                  	              	table.reload('AllTable6', {data:data2.data});
                  	              	table.reload('AllTable7', {data:data2.data});
                  	              	table.reload('AllTable8', {data:data2.data});
                  				},1000);
                			}
            			})
            		});
              },500000);
          });
    </script>

</body>

</html>